package com.jjc.android.dialog

import android.content.Context
import android.content.Intent
import android.view.View
import android.view.ViewGroup
import com.allen.library.SuperButton
import com.jjc.android.R
import com.jjc.android.activity.BindDeviceActivity
import com.jjc.android.view.onClick
import com.lxj.xpopup.core.CenterPopupView
import com.lxj.xpopup.util.XPopupUtils

class BindDeviceDialog(context: Context) : CenterPopupView(context){
    private lateinit var bindDeviceBtn: SuperButton

    override fun onCreate() {
        super.onCreate()
        initViews(this)
        bindDeviceBtn.onClick {
            context.startActivity(Intent(context,BindDeviceActivity::class.java))
        }
    }


    override fun getImplLayoutId(): Int {
        return R.layout.dialog_bind_device
    }

    override fun getPopupWidth(): Int {
        return (XPopupUtils.getScreenWidth(context)*0.9f).toInt()
    }

    override fun getPopupHeight(): Int {
        return ViewGroup.LayoutParams.WRAP_CONTENT
    }

    private fun initViews(view: View) {
        bindDeviceBtn = view.findViewById(R.id.bindDeviceBtn)
    }

}